package com.cspg.design.http;

import com.cspg.design.bean.deviceBean.HotLineWorkPlanBean;
import com.cspg.design.bean.modelLibrary.TowerLibrary;
import com.cspg.design.bean.modelLibrary.TransformerLibrary;
import com.cspg.design.bean.modelLibrary.WireLibrary;
import com.cspg.design.bean.userInfoBean.UserInfoBean;
import com.cspg.design.dto.AuthUserDto;
import com.cspg.design.dto.Device;
import com.cspg.design.dto.MyHighVoltageSchemeDto;
import com.cspg.design.dto.MyLowVoltageSchemeDto;
import com.cspg.design.dto.PointDeviceDto;
import com.cspg.design.dto.PoleLibraryDto;
import com.cspg.design.dto.PolylineDeviceDto;
import com.cspg.design.dto.ProjectDto;
import com.cspg.design.dto.ProjectProcessInformation;
import com.cspg.design.dto.submit.HotLineWork;
import com.cspg.design.dto.submit.ProjectSubmitToReviewDto;
import com.cspg.design.model.HotLineWorkModel;
import com.cspg.design.model.LocalStorageModel;
import com.cspg.design.model.MyHighVoltageSchemeModel;
import com.cspg.design.model.MyLowVoltageSchemeModel;
import com.cspg.design.model.PassVo;
import com.cspg.design.model.PointDevicesModel;
import com.cspg.design.model.PoleLibraryModel;
import com.cspg.design.model.PolylineDevicesModel;
import com.cspg.design.model.ProjectModel;
import com.cspg.design.model.ResponseResult;
import com.cspg.design.model.TransformerLibraryModel;
import com.cspg.design.model.UserModel;
import com.cspg.design.model.WireLibraryModel;

import java.util.List;
import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.HTTP;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import retrofit2.http.Url;

/**
 * Created by Kun Chan on 2017/4/17.
 */

public interface IService {


//    @Headers({ "Content-Type: application/json;charset=UTF-8"})
//    @POST("auth/loginnocode")
//    Call<UserModel> login(@Body String  json);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("auth/loginnocode")
    Call<UserModel> login(@Body AuthUserDto authUserDto);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("api/users/updatePass")
    Call<ResponseBody> updatePassword(@Body PassVo passVo);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("auth/info")
    Call<UserModel> userInfo();

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/Project")
    Call<ProjectModel> designProject(@Query("page") Integer page, @Query("size") Integer size, @Query("designUnit") String designUnit);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/Project")
    Call<ProjectModel> constructionProject(@Query("page") Integer page, @Query("size") Integer size, @Query("constructionUnit") String constructionUnit);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/cspgHotLineWork")
    Call<HotLineWorkModel> hotLineWorkGet(@Query("page") Integer page, @Query("size") Integer size, @Query("projectId") String projectId);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("api/cspgHotLineWork")
    Call<HotLineWorkPlanBean> hotLineWorkAdd(@Body HotLineWorkPlanBean hotLineWorkPlanBean);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @PUT("api/cspgHotLineWork")
    Call<HotLineWorkPlanBean> hotLineWorkUpdate(@Body HotLineWorkPlanBean hotLineWorkPlanBean);


    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @PUT("api/Project")
    Call<ProjectDto> updateProject(@Body ProjectDto projectDto);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("api/Project/add")
    Call<ResponseBody> uploadAllDevice(@Body Device device);

    /**
     * 获取杆塔库
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/PoleLibrary")
    Call<PoleLibraryModel> getPoleLibrary(@Query("page") Integer page, @Query("size") Integer size);

    /**
     * 获取导线库
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/WireLibrary")
    Call<WireLibraryModel> getWireLibrary(@Query("page") Integer page, @Query("size") Integer size);

    /**
     * 获取变压器库
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/TransformerLibrary")
    Call<TransformerLibraryModel> getTransformerLibrary(@Query("page") Integer page, @Query("size") Integer size);

    /**
     * 更新高压方案
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @PUT("api/MyHighVoltageScheme")
    Call<MyHighVoltageSchemeDto> updateMyHighVoltageScheme(@Body MyHighVoltageSchemeDto myHighVoltageSchemeDto);
    /**
     * 新增高压方案
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("api/MyHighVoltageScheme")
    Call<MyHighVoltageSchemeDto> addMyHighVoltageScheme(@Body MyHighVoltageSchemeDto myHighVoltageSchemeDto);
    /**
     * 查询高压方案
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/MyHighVoltageScheme")
    Call<MyHighVoltageSchemeModel> getMyHighVoltageScheme(@Query("page") Integer page, @Query("size") Integer size);

    /**
     * 更新低压方案
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @PUT("api/MyLowVoltageScheme")
    Call<MyLowVoltageSchemeDto> updateMyLowVoltageScheme(@Body MyLowVoltageSchemeDto myLowVoltageSchemeDto);
    /**
     * 新增低压方案
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("api/MyLowVoltageScheme")
    Call<MyLowVoltageSchemeDto> addMyLowVoltageScheme(@Body MyLowVoltageSchemeDto myLowVoltageSchemeDto);
    /**
     * 查询低压方案
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/MyLowVoltageScheme")
    Call<MyLowVoltageSchemeModel> getMyLowVoltageScheme(@Query("page") Integer page, @Query("size") Integer size);
    /**
     * 新增点设备
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("api/PointDevice")
    Call<PointDeviceDto> addPointDevice(@Body PointDeviceDto pointDeviceDto);
    /**
     * 新增线设备
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/PolylineDevice")
    Call<PolylineDeviceDto> addPolylineDevice(@Body PolylineDeviceDto polylineDeviceDto);

    /**
     * 批量新增点设备
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("api/PointDevice/all")
    Call<List<PointDeviceDto>> addPointDeviceAll(@Body List<PointDeviceDto> pointDeviceDtoList);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/PointDevice")
    Call<PointDevicesModel> getPointDeviceByProjectId(@Query("page") Integer page, @Query("size") Integer size, @Query("projectId") String projectId);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @HTTP(method = "DELETE",path = "api/PointDevice",hasBody = true)
    Call<ResponseBody> deletePointDeviceAll(@Body String projectId);
    /**
     * 批量新增线设备
     *
     * @return
     */
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("api/PolylineDevice/all")
    Call<List<PolylineDeviceDto>> addPolylineDeviceAll(@Body List<PolylineDeviceDto> polylineDeviceDtoList);
    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @GET("api/PolylineDevice")
    Call<PolylineDevicesModel> getPolylineDeviceByProjectId(@Query("page") Integer page, @Query("size") Integer size, @Query("projectId") String projectId);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @HTTP(method = "DELETE",path = "api/PolylineDevice",hasBody = true)
    Call<ResponseBody> deletePolylineDeviceAll(@Body String projectId);
    /**
     * 上传图片
     *
     * @param multipartBody
     * @return
     */
    @POST("api/localStorage/add")
    Call<ResponseBody> upload(@Url() String url, @Body MultipartBody multipartBody);

    /**
     * 上传图片
     *
     * @param multipartBodys
     * @return
     */
    @POST()
    Call<ResponseBody> uploadBatch(@Url String url ,@Body List<MultipartBody> multipartBodys);
    /**
     * 简便写法
     * @param description
     * @param map
     * @return
     */
    @Multipart
    @POST("api/localStorage/add")
    Call<ResponseBody> uploadImage(@Part("description") String description, @PartMap
            Map<String, RequestBody> map);

    //多文件上传2
    @POST("api/localStorage/addBatch")
    Call<List<LocalStorageModel>> uploadFilesMultipartBody(@Body MultipartBody multipartBody);

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("SocketService")
    Call<ResponseResult> projectSubmit(@Query("ProjectId") String ProjectId, @Query("loginName") String loginName, @Query("ProjectJsonStr") String  ProjectJsonStr );

    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("SocketService")
    Call<ResponseResult> projectSubmitToReview(@Body ProjectSubmitToReviewDto submitToReviewDto);


    @Headers({"Content-Type: application/json;charset=UTF-8"})
    @POST("GetProjectProcessInformation")
    Call<List<ProjectProcessInformation>> projectFlow(@Query("ProjectID") String ProjectID);

}
